home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 2
/
Amiga Tools 2.iso
/
tools
/
filer
/
rexx
/
extern.filer
< prev
next >
Wrap
Text File
|
1995-03-09
|
4KB
|
136 lines
/*
$VER: Extern.filer 1.2 (24.11.93)
Authors:
Michael Boehnisch (billy@uni-paderborn.de) (mb)
Matthias Scheler (tron@uni-paderborn.de) (ms)
Function:
External AmigaDOS Command Interface for Filer 3.10. Calls
arbitrary commands with selected files in Filer's source
window as arguments, recurses through selected directories.
Requires:
C:Resident
More
Call:
Extern CMD [RES] [OPT1] ... [OPT5]
CMD - AmigaDOS command to execute on selected files
RES - determines if Cmd is to be made resident. Set to 1
if you wish "extern" to try. Any other value loads
Cmd from disk each time it is executed (not
recommended)
OPT? - Options passed directly to Cmd
Examples for "Filer.RC":
XBUTTON 3,0,0,1,"Version","Extern C:Version 1"
XBUTTON 3,2,0,1,"Strings","Extern WhatIs 1 A 5"
History:
18.06.1992 First release (mb)
21.06.1992 Review for Filer 3.00 Gamma 8 (ms)
23.06.1992 Removed bug with missing " signs around
file names. Now works correctly on file
names with embedded white space. (mb)
24.11.1993 Major rewiew for Filer 3.10 Gamma release:
- adaptet this header
- removed small bug when dirs are selected
- added HISTORY support
(mb)
*/
Cmd = 'Echo' /* Default values for Arguments */
Res = 1
Opt1 = ''
Opt2 = ''
Opt3 = ''
Opt4 = ''
Opt5 = ''
ARG Cmd Res Opt1 Opt2 Opt3 Opt4 Opt5 /* Cmd := command to execute */
/* Res := make resident? Yes=1 */
/* OptX := options for command */
OPTIONS RESULTS /* aquire results */
ADDRESS 'FilerRexx' /* default to Filer's ReXX port */
PANEL OFF /* switch command buttons off */
IF Res = 1 THEN DO /* make Cmd resident? */
SHELL COMMAND 'Resident' Cmd /* Yes */
END
TEMPFILENAME /* get name for temporary files */
IF RESULT = 'RESULT' THEN EXIT 5
TmpFile = RESULT /* used for output file */
TOTEMPF = '>>' TmpFile
TmpFileX = RESULT || 'x' /* help file for subdirectories */
TOTMPFX = '>>' TmpFileX
Opts = '' /* build option string */
if Opt1 ~= '' THEN Opts = ' ' || Opt1
if Opt2 ~= '' THEN Opts = Opts Opt2
if Opt3 ~= '' THEN Opts = Opts Opt3
if Opt4 ~= '' THEN Opts = Opts Opt4
if Opt5 ~= '' THEN Opts = Opts Opt5
GETSOURCEPATH /* get source directory name */
IF RESULT = 'RESULT' THEN EXIT 5
PRAGMA('D', RESULT) /* change dir there */
GETNUMENTRIES /* get number of source entries */
IF RESULT = 'RESULT' THEN EXIT 5
Anzahl = RESULT
DO i = 1 TO Anzahl /* loop through all entries */
GETNAME i /* get ith entry */
IF RESULT = 'RESULT' THEN EXIT 5
Eintrag = RESULT
Type = LEFT(Eintrag, 1) /* parse filetype (f, d, F, D) */
Name = SUBSTR(Eintrag, 2) /* parse filename */
SELECT
/* if selected entry is a directory, use AmigaDOS "List" command to */
/* recurse through deeper levels */
WHEN Type = 'd' THEN DO
'HISTORY External call of Cmd="'||Cmd||Opts||'", Res="'||Res||'", Dir ="'||Name||'"'
SHELL COMMAND Echo TOTMPFX "FailAt 30"
SHELL COMMAND 'List' Name 'ALL FILES LFORMAT="'||Cmd||Opts '*"%p%n*"' TOTEMPF '"' TOTMPFX
SHELL COMMAND 'Execute' TmpFileX
SHELL COMMAND 'Delete' TmpFileX
TOGGLEENTRY i
END
/* if selected entry is a file, call Cmd directly */
WHEN Type = 'f' THEN DO
'HISTORY External call of Cmd="'||Cmd||Opts||'", Res="'||Res||'", File="'||Name||'"'
SHELL COMMAND Cmd||Opts '"'||Name||'"' TOTEMPF
TOGGLEENTRY i
END
/* ignore entries not selected (types D and F) */
OTHERWISE
END /* SELECT */
END /* DO i */
EXEC 'More' TmpFile /* use AmigaDOS More for result */
SHELL COMMAND 'Delete' TmpFile /* delete temporary files */
IF Res ~= 1 THEN DO
SHELL COMMAND 'Resident REMOVE' Cmd /* remove cmd from resident list*/
END
PANEL ON /* activate command buttons */